import { _decorator, Component, native, Node, sys } from 'cc';

export enum ohPages {
    CameraPage = 'pages/CameraPage',
    DocPage = 'pages/DocPage'
}


class OhCtrl {

    ohTTS(text: string) {
        if (sys.platform !== sys.Platform.OPENHARMONY) return;
        native.reflection.callStaticMethod("entry/src/main/ets/ability/AbilityCtrl", "entry/ohTTS", text, true);
    }
    ohASR(state:boolean) {
        native.reflection.callStaticMethod("entry/src/main/ets/ability/AbilityCtrl", "entry/ohASR", state?"true":"false", true);
    }
    openPage(page: ohPages) {
        native.reflection.callStaticMethod("entry/src/main/ets/ability/AbilityCtrl", "entry/openPage", page, true);

    }

    getDarkState(): boolean {
        if (sys.platform == sys.Platform.OPENHARMONY) {
            const state = native.reflection.callStaticMethod("entry/src/main/ets/ability/AbilityCtrl", "entry/getDarkState", '', true);
            return (state == "dark") ? false : true;
        }
        else {
            return false;
        }
    }

}

const oh = new OhCtrl();
export default oh;

